﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using ODP.Com;
using ODP.Model;

namespace ODP.Web.Controllers
{
    public class HomeController : Controller
    {
        //
        // GET: /Home/

        public ActionResult Index()
        {
            QQAPI.QQOAuth Qoa = new QQAPI.QQOAuth();

            Qoa.GetRequestToken();

            Current.OAuth = new QQAPI.QQOAuth(Qoa);
            Current.tType = Qoa.twitterType;

            string url = "http://open.t.qq.com/cgi-bin/authorize?oauth_token=" + Qoa.tokenKey;

            return Redirect(url);
        }

        public ActionResult Default()
        {

            if (string.IsNullOrEmpty(Current.OAuth.verify))
            {
                Current.OAuth.verify = this.Request.QueryString["oauth_verifier"];

                Current.OAuth.GetAccessToken();
            }

            return View();
        }

    }
}
